<%@ page contentType="text/html; charset=UTF-8"%>
<!-- JSTL을 사용하기위해 필요함 -->
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<%
	request.setCharacterEncoding("UTF-8");
	String cp = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>파일업로드</title>
<link rel="stylesheet" href="<%=cp %>/data/css/style.css" type="text/css">
<script type="text/javascript" src="<%=cp%>/data/js/util.js"></script>

<script type="text/javascript">
	
	function sendIt(){
		
		var f = document.myForm;
		
		str = f.subject.value;
		str = str.trim();		
		if(!str){
			alert("\n제목을 입력하세요.");
			f.subject.focus();
			return;
		}
		f.subject.value = str;
		
		str = f.upload.value;
		str = str.trim();		
		if(!str){
			alert("\n업로드할 파일을 선택하세요.");
			f.upload.focus();
			return;
		}
		f.upload.value = str;
		
		f.action = "<%=cp%>/community/save.action";
		f.submit();
	}
	
</script>
</head>
<body topmargin="20" marginwidth="20" leftmargin="20" marginheight="20" 
	bgcolor="#ffffff" onload="document.myForm.subject.focus();">
	<br/>
	<table width="900" cellpadding="0" cellspacing="3" align="center">
		<tr>
			<td bgcolor="#ffffff" align="center">
				<font size="5" face="휴먼편지체"><b>이미지 게시판</b></font><br/><br/>
			</td>
		</tr>
	</table>
	
	<form action="" method="post" name="myForm" enctype="multipart/form-data">
		<table width="560" border="0" cellpadding="3" cellspacing="0" align="center">
			<tr><td colspan="2" class="line3" bgcolor="#dbdbdb" align="center"></td></tr>
			<tr>
				<td width="20%" height="30" bgcolor="#eeeeee" style="padding-left:20px;">
					제&nbsp;&nbsp;&nbsp;&nbsp;목
				</td>
				<td width="80%" style="padding-left:10px;">
					<input type="text" name="subject" size="74" maxlength="100" class="boxTF"/>
				</td>
			</tr>
			
			<tr>
				<td width="20%" height="30" bgcolor="#eeeeee" style="padding-left:20px;">
					첨부파일
				</td>
				<td width="80%" style="padding-left:10px;">
					<input type="file" name="upload" size="58" maxlength="100" class="boxTF" style="height: 20px;"/>
				</td>
			</tr>
			
			<tr height="35">
				<td align="center" width="100" bgcolor="#E8D9FF"><b>지역</b></td>
				<td style="padding-left: 5px;">&nbsp;&nbsp;&nbsp;
				<input type="radio" name="area" value="1" checked="checked"><b>유럽</b>&nbsp;&nbsp;&nbsp;
				<input type="radio" name="area" value="2" ><b>아시아</b>&nbsp;&nbsp;&nbsp;
				<input type="radio" name="area" value="3" ><b>아메리카</b>&nbsp;&nbsp;&nbsp;
				<input type="radio" name="area" value="4" ><b>오세아니아</b>&nbsp;&nbsp;&nbsp;
				<input type="radio" name="area" value="5" ><b>아프리카</b>&nbsp;&nbsp;&nbsp;
				</td>
			</tr>
			<tr><td colspan="2" class="line3" bgcolor="#dbdbdb" align="center"></td></tr>
		</table>
		
		<table width="560" border="0" cellpadding="3" cellspacing="0" align="center">
			<tr align="center">
				<td height="40">
					<input type="hidden" name="mode" value="save"/>
					<input type="button" value=" 등록하기 " class="btn1" onclick="sendIt();"/>
					<input type="reset" value=" 다시입력 " class="btn1" 
						onclick="document.myForm.subject.focus();"/>
					<input type="button" value=" 작성취소 " class="btn1" 
						onclick="javascript:location.href='<%=cp%>/community/gallary.action?pageNum=${pageNum }';"/>
				</td>
			</tr>
		</table>		
	</form>
</body>
</html>